use bzero() instead of memset_s()
authorDebian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
Tue, 28 Jul 2026 12:02:03 +0000 (15:02 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 28 Jul 2026 12:02:03 +0000 (15:02 +0300)
commit76492ef1e303fc0739f0afaf3e1b7b42de7a2f79
tree2be18108e082319bc0222cbf5f6361e5ced91d64
parent0df528d7957aa630f3f455aa34e4b12beb21ef90
use bzero() instead of memset_s()

lib/replace/replace.h header defines ZERO_STRUCT macro
which uses memset_s() function (which is similar to
memset() but can not be optimized out by the compiler).
Glibc has bzero() with similar property, while memset_s()
have is implemented in lib/replace/replace.c, - this way,
some binaries needlessly link with libreplace-samba4 just
to get rep_memset_s() symbol. By using bzero() instead,
this endless linkage is eliminated, so we can package,
for example, libldb (which uses ZERO_STRUCT) without it
linking to libreplace-samba4.

Note: actually using explicit_bzero() so it is not optimized
out by the compiler - this is the original goal of using
memset_s().

Gbp-Pq: Name use-bzero-instead-of-memset_s.diff
lib/replace/replace.h